class TokenList {
    constructor(tokens) {
        this.tokens = tokens
        this.index = 0
    }
    readToken() {
        let i = this.index
        this.index += 1
        if (i < this.tokens.length) {
            return this.tokens[i]
        } else {
            return null
        }
    }
    peekToken(offset = 0) {
        let i = this.index + offset
        if (i < this.tokens.length) {
            return this.tokens[i]
        } else {
            return null
        }
    }
    hasToken() {
        return this.index < this.tokens.length
    }
}

module.exports = TokenList